home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / System 7.0 Samples / MacShell / Start.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-04  |  1.9 KB  |  88 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** Program:          MacShell
  5. ** File:             start.c
  6. ** Originally from:  Traffic Light 2.0 (2.0 version by Keith Rollin)
  7. ** Modified by:      Eric Soldan
  8. **
  9. ** Copyright © 1989-1991 Apple Computer, Inc.
  10. ** All rights reserved.
  11. */
  12.  
  13.  
  14.  
  15. /*****************************************************************************/
  16.  
  17.  
  18.  
  19. #define declare_main_structs
  20.  
  21. #include "MacShell.h"            /* Get the MacShell includes/typedefs, etc.    */
  22. #include "MacShellCommon.h"        /* Get the stuff in common with rez.        */
  23. #include "MacShell.protos"        /* Get the prototypes for MacShell.            */
  24.  
  25. #ifndef __TOOLUTILS__
  26. #include <ToolUtils.h>
  27. #endif
  28.  
  29.  
  30.  
  31. /*****************************************************************************/
  32.  
  33.  
  34.  
  35. #ifndef THINK_C
  36. extern void _DataInit();
  37. #endif
  38.  
  39.  
  40.  
  41. /*****************************************************************************/
  42. /*****************************************************************************/
  43.  
  44.  
  45.  
  46. #pragma segment Main
  47. void    main(void)
  48. {
  49. #if MACSHELL_VERSION
  50.     NamesTableEntry    appNTE;
  51.     EntityName        appEntityName;
  52.     OSErr            atErr;
  53. #endif
  54.  
  55. #ifndef THINK_C
  56.     UnloadSeg((Ptr)_DataInit);        /* Note that _DataInit can't be in Main! */
  57. #endif
  58.     
  59.     /*     If you have stack requirements that differ from the default, then you
  60.     ** could use SetApplLimit to increase StackSpace at this point, before
  61.     ** calling MaxApplZone.
  62.     */
  63.  
  64.     MaxApplZone();                    /* Expand the heap so code segments load at the top. */
  65.  
  66.     Initialize();                            /* Initialize the program. */
  67.     DoSetCursor(*GetCursor(watchCursor));    /* Rest of startup may take a while. */
  68.  
  69.     StartDocuments();                /* Open (or print) designated documents. */
  70.  
  71.     UnloadSeg((Ptr)Initialize);        /* Initialize can't be in Main! */
  72.  
  73. #if MACSHELL_VERSION
  74.     atErr = AddPPCNBPAlias(&appNTE, "\pMacShell", &appEntityName);
  75. #endif
  76.  
  77.     EventLoop();                    /* Call the main event loop. */
  78.  
  79. #if MACSHELL_VERSION
  80.     if (!atErr) RemoveNBPAlias(&appEntityName);
  81. #endif
  82.  
  83.     ExitToShell();                    /* Quit the application. */
  84. }
  85.  
  86.  
  87.  
  88.